﻿@{
    Layout = null;
}

<!DOCTYPE html>
<html>
<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title>图书管理系统 | 手机找回密码</title>

    <link href="~/Content/bootstrap.min.css" rel="stylesheet">
    <link href="~/Fonts/font-awesome/css/font-awesome.css" rel="stylesheet">
    <script src="~/Scripts/jquery-3.1.1.min.js"></script>
    <link href="~/Content/animate.css" rel="stylesheet">
    <link href="~/Content/style.css" rel="stylesheet">
    <script src="~/Scripts/jquery.unobtrusive-ajax.min.js"></script>
    @Styles.Render("~/Content/plugins/iCheck/iCheckStyles")
    @Styles.Render("~/plugins/wizardStepsStyles")
    @Scripts.Render("~/plugins/wizardSteps")
    @Scripts.Render("~/plugins/iCheck")
    @Scripts.Render("~/plugins/validate")


</head>

<body class="gray-bg">

    <div class="loginColumns animated fadeInDown">
        <div class="row" style="margin-bottom:30px;">
            <img src="~/Content/Images/hjmtop.jpg" />
        </div>
        <div class="row">

            <div class="col-md-4">
                <h2 class="font-bold">验证手机找回密码</h2>

                <p>
                    如果您忘记了原有密码，您可以根据提示找回您的账户密码，遇到所有问题可以联系管理员，手机号码13276349637。
                </p>

                <p>
                    请不要向任何人透露您的手机验证码和邮箱验证码，这会使您的账户安全得不到保证！
                </p>

                <p>
                    您使用此系统中遇到的所有问题都可以给我们留言。
                </p>

                <p>
                    <small>撸起袖子加油干，越是艰险越向前，一起加油吧！</small>
                </p>

            </div>
            <div class="col-md-8">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <h5>重置密码</h5>
                        <div class="ibox-tools">
                            <a class="collapse-link">
                                <i class="fa fa-chevron-up"></i>
                            </a>
                            <a class="dropdown-toggle" data-toggle="dropdown" href="#">
                                <i class="fa fa-wrench"></i>
                            </a>
                            <ul class="dropdown-menu dropdown-user">
                                <li>
                                    <a href="#">Config option 1</a>
                                </li>
                                <li>
                                    <a href="#">Config option 2</a>
                                </li>
                            </ul>
                            <a class="close-link">
                                <i class="fa fa-times"></i>
                            </a>
                        </div>
                    </div>
                    <div class="ibox-content">
                        <p>
                            请根据提示操作
                        </p>



                        <div id="wizard">

                            <h1>输入手机</h1>
                            <div class="step-content">
                                <div class="text-center m-t-md">
                                    @using (Ajax.BeginForm("SendPhoneCode", "Admins", new AjaxOptions { UpdateTargetId = "box" },new {id="formsend" }))
                                    {
                                        <h2>请输入手机号码</h2>
                                        <p>

                                            <input type="text" id="address" class="form-control" name="phone" />
                                            @*<input type="submit" value="发送验证码" />*@
                                        </p>
                                    }
                                </div>
                            </div>

                            <h1>输入验证码</h1>
                            <div class="step-content">
                                <div class="text-center m-t-md">
                                    <h2>输入验证码</h2>
                                    <p>
                                        <input type="text" name="code" class="form-control" id="code" value="" />
                                    </p>
                                </div>
                            </div>

                            <h1>输入新密码</h1>
                            <div class="step-content">
                                <div class="text-center m-t-md">
                                    <h2>输入新密码</h2>
                                    <p>
                                        @using (Ajax.BeginForm("ResetPassEmail", "Admins", new AjaxOptions { UpdateTargetId = "box" }, new { id = "resetPwd" }))
                                        {
                                            <input type="text" class="form-control" id="password" name="password" value="" />
                                            <input type="hidden" name="code1" id="code1" value="" />
                                            @*<input type="submit" value="确认更改" />*@
                                        }
                                    </p>
                                </div>
                            </div>
                        </div>

                    </div>
                    <div class="alert alert-success" id="box">
                        
                    </div>
                </div>
                @*<div class="ibox-content">
                        <form class="m-t" role="form" action="index.html">
                            <div class="form-group">
                                <input type="email" class="form-control" placeholder="Username" required="">
                            </div>
                            <div class="form-group">
                                <input type="password" class="form-control" placeholder="Password" required="">
                            </div>
                            <button type="submit" class="btn btn-primary block full-width m-b">Login</button>

                            <a href="#">
                                <small>Forgot password?</small>
                            </a>

                            <p class="text-muted text-center">
                                <small>Do not have an account?</small>
                            </p>
                            <a class="btn btn-sm btn-white btn-block" href="register.html">Create an account</a>
                        </form>
                        <p class="m-t">
                            <small>Inspinia we app framework base on Bootstrap 3 &copy; 2014</small>
                        </p>
                    </div>*@
            </div>
        </div>
        <hr />
        <div class="row">
            <div class="col-md-6">
                图书管理系统
            </div>
            <div class="col-md-6 text-right">
                <small>© 2020-2021</small>
            </div>
        </div>
    </div>
    <script type="text/javascript">
        $(document).ready(function () {

            $("#wizard").steps({
                labels: {
            finish: "修改密码", // 修改按钮得文本
            next: "下一步", // 下一步按钮的文本
            previous: "上一步", // 上一步按钮的文本
            loading: "Loading ..."
        },
                onStepChanging: function (event, currentIndex, newIndex) {
                    var result = false;
                    if (currentIndex === 0) {//第二步操作
                        if ($("#address").val().trim() != "") {
                            result = true;
                        }
                     }
                    else if (currentIndex === 1) {//第二步操作

                        if ($("#code").val().trim() != "") {
                            if ($("#box").text() != "系统没有此用户") {
                            result = true;

                            }
                        }
                    }
                    else if (currentIndex === 2) {//第二步操作
                        if ($("#password").val().trim() != "") {
                            result = true;
                        }
        	         }

            
                    return result;
                    ////// Disable validation on fields that are disabled or hidden.
                    ////form.validate().settings.ignore = ":disabled,:hidden";

                    ////// Start validation; Prevent going forward if false
                    ////return form.valid();
                },
                onStepChanged: function (event, currentIndex, priorIndex) {
                    
                    
                         
                    
                    if (currentIndex === 1 && priorIndex === 0) {
                        $("#formsend").submit();
                         
                   }

                    // Suppress (skip) "Warning" step if the user is old enough.
                    //if (currentIndex === 2 && Number($("#age").val()) >= 18) {
                    //    $(this).steps("next");
                    //}
                    
                    //// Suppress (skip) "Warning" step if the user is old enough and wants to the previous step.
                    //if (currentIndex === 2 && priorIndex === 3) {
                    //    $(this).steps("previous");
                    //}
        },
            onFinished: function (event, currentIndex) {
                        $("#resetPwd").submit();
                    
                }

            });
            //$("#form").steps({
            //    bodyTag: "fieldset",
            //    onStepChanging: function (event, currentIndex, newIndex) {
            //        // Always allow going backward even if the current step contains invalid fields!
            //        if (currentIndex > newIndex) {
            //            return true;
            //        }

            //        // Forbid suppressing "Warning" step if the user is to young
            //        if (newIndex === 3 && Number($("#age").val()) < 18) {
            //            return false;
            //        }

            //        var form = $(this);

            //        // Clean up if user went backward before
            //        if (currentIndex < newIndex) {
            //            // To remove error styles
            //            $(".body:eq(" + newIndex + ") label.error", form).remove();
            //            $(".body:eq(" + newIndex + ") .error", form).removeClass("error");
            //        }

            //        // Disable validation on fields that are disabled or hidden.
            //        form.validate().settings.ignore = ":disabled,:hidden";

            //        // Start validation; Prevent going forward if false
            //        return form.valid();
            //    },
            //    onStepChanged: function (event, currentIndex, priorIndex) {
            //        // Suppress (skip) "Warning" step if the user is old enough.
            //        if (currentIndex === 2 && Number($("#age").val()) >= 18) {
            //            $(this).steps("next");
            //        }
                    
            //        // Suppress (skip) "Warning" step if the user is old enough and wants to the previous step.
            //        if (currentIndex === 2 && priorIndex === 3) {
            //            $(this).steps("previous");
            //        }
            //    },
            //    onFinishing: function (event, currentIndex) {
            //        var form = $(this);

            //        // Disable validation on fields that are disabled.
            //        // At this point it's recommended to do an overall check (mean ignoring only disabled fields)
            //        form.validate().settings.ignore = ":disabled";

            //        // Start validation; Prevent form submission if false
            //        return form.valid();
            //    },
            //    onFinished: function (event, currentIndex) {
            //        var form = $(this);
                    
            //        // Submit form input
            //        form.submit();
            //    }
            //}).validate({
            //    errorPlacement: function (error, element) {
            //        element.before(error);
            //    },
            //    rules: {
            //        confirm: {
            //            equalTo: "#password"
            //        }
            //    }
            //});

        });
    </script>
    <script type="text/javascript">
        $(function () {
            $("#resetPwd").submit(function () {
               
                $("#code1").val($("#code").val());
                //alert($("#code1").val());
            });
        });
    </script>


</body>


</html>


